

#ifndef __PID_CONTROLLER_H__
#define __PID_CONTROLLER_H__

#ifdef PID_CONTROLLER_H_GLOBAL
  #define PID_CONTROLLER_H_EXTERN 
#else
  #define PID_CONTROLLER_H_EXTERN extern
#endif

#include "pid.h"
//#include "controller.h"

typedef struct pid_feedback *pid_feedback_t;

struct pid_feedback
{
  float feedback;
};

typedef struct cascade *cascade_t;

struct cascade
{
  struct pid outer;
  struct pid inter;
};

typedef struct cascade_feedback *cascade_feedback_t;

struct cascade_feedback
{
  float outer_fdb;
  float inter_fdb;
};

int32_t pid_control(struct controller *ctrl, void *param, void *feedback, float input);
int32_t cascade_control(struct controller *ctrl, void *param, void *feedback, float input);
int32_t pid_controller_register(struct controller *ctrl,
                                const char *name,
                                struct pid *param,
                                struct pid_feedback *input,
                                uint8_t enable);
int32_t cascade_controller_register(struct controller *ctrl,
                                    const char *name,
                                    struct cascade *param,
                                    struct cascade_feedback *input,
                                    uint8_t enable);
#endif // __PID_CONTROLLER_H__
